using System;

namespace SubversionReports.Web
{
    public class Page : System.Web.UI.Page
    {
        /// <summary>
        /// Handles the Error event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Error(object sender, EventArgs e)
        {
            try { Session["LastException"] = Server.GetLastError().GetBaseException(); }
            catch { Session["LastException"] = null; }
            finally { Response.Redirect((Request.ApplicationPath.EndsWith("/") ? Request.ApplicationPath : (Request.ApplicationPath + "/")) + "Error.aspx"); }
        }
    }
}
